package com.lc.cn.managersys.dao.example;

import java.util.List;

import com.lc.cn.managersys.common.Page;
import com.lc.cn.managersys.common.TestBase;
import com.lc.cn.managersys.model.example.UserForm;

/**
 * example test
 * @author luo_guang
 *
 */
public class UserDaoTest extends TestBase {

	private UserDao dao = null;
	
	protected void setUp() throws Exception {
		super.setUp();
		dao = (UserDao)context.getBean("userDao");
	}
	
	public void testGetUsers() {
		UserForm users = dao.getUser();
		assertNotNull(users);
		assertNotNull(users.getAddress(),"杭州1");
	}
	
	public void testdeleteUser() {
		dao.deleteUser();
	}
	
	public void testCountUser() {
		int rows = dao.countUser();
		System.out.println(rows);
		assertEquals(rows, 3);
	}
	
	@SuppressWarnings("unchecked")
	public void testListUsers() {
		List users = dao.listUsers();
		assertEquals(users.size(), 3);
	}
	
	public void testInsertUser() {
		long key = dao.insertUser();
		assertEquals(key, 6);
	}
	
	public void testPageUser() {
		Page page = dao.pageUser();
		System.out.println("page list size:" + page.getList().size());
		assertEquals(page.getCurPage(), 1);
	}
	
}
